<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>毕业生信息填报表单</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="css.css"/>
  <script src="js/jquery.min.js" type="text/javascript"></script>




</head>

<body>


   
 
  <div class="head">
      <div class="img">
        <img src="img/1.jpg">
      </div>
      <div class="img2">
         <img src="" >
        <p></p>
      </div>
   </div>
      

              
<fieldset class=" layui-elem-field layui-field-title " style="margin-top: 20px;">
  <legend>毕业生信息填报</legend>
</fieldset>


 
<form class="layui-form" >
    


  
  <div class="layui-form-item">
    <label class="layui-form-label addRedStar  ">姓名</label>
    <div class="layui-input-inline">
      <input type="text" name="name" id="name" lay-verify="title" placeholder="请输入姓名" class="layui-input"  >
    </div>
    
     <input type="text" name="user_id" id="user_id" lay-verify="title" placeholder="请输入user_id" class="layui-input" style="display:none"  >

     <label class="layui-form-label addRedStar">学号</label>
    <div class="layui-input-inline">
      <input type="text" name="student_num" lay-verify="title" placeholder="请输入学号" class="layui-input">
    </div>

    <label class="layui-form-label addRedStar">联系电话</label>
      <div class="layui-input-inline">
        <input type="tel" name="tel"  autocomplete="off" class="layui-input" placeholder="请输入联系电话">
      </div>
  </div>


<div class="layui-form-item">



    <label class="layui-form-label addRedStar">年级</label>
    <div class="layui-input-inline">
      <select name="grade" lay-filter="aihao" id="grade" >
        <div style="color:red"><option  >请选择</option></div>
      </select> 
    
    </div>

    <label class="layui-form-label addRedStar">专业</label>
    <div class="layui-input-inline">
      <select name="major" lay-filter="aihao" id="a1" ></select> 
    </div>

     <div class="layui-input-inline">
      <select name="class" lay-filter="aihao" id="a2"> </select>
    </div>

  </div>

  <div class="layui-form-item">
    <label class="layui-form-label addRedStar">就业方向</label>
    <div class="layui-input-block">
      <div style="float:left" onclick="app2(0)">
        <input type="radio" name="g_des" value="签三方协议就业" title="签三方协议就业" checked="">
      </div>
      <div style="float:left"  onclick="app2(0)">
      <input type="radio" name="g_des" value="签合同或灵活就业协议" title="签合同或灵活就业协议">
      </div>
      <div style="float:left"  onclick="app2(1)">
      <input type="radio" name="g_des" value="考取研究生" title="考取研究生" >
      </div>
    </div>
  </div>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
  
<div class="layui-form-item app3" style="display:none">
    <label class="layui-form-label addRedStar">学校名称</label>
    <div class="layui-input-inline">
      <input type="text" name="u_name" lay-verify="title" placeholder="请输入单位名称" class="layui-input">
    </div>  
</div>    


  <div class="layui-form-item app3" style="display:none">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1" >立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>

  <div class="layui-form-item app2">
    <label class="layui-form-label addRedStar">单位名称</label>
    <div class="layui-input-inline">
      <input type="text" name="u_name" lay-verify="title" placeholder="请输入单位名称" class="layui-input">
    </div>

    <label class="layui-form-label addRedStar">单位性质</label>
    <div class="layui-input-inline">
      <select name="u_nature" lay-filter="aihao" id='a3'></select>
    </div>
  </div>
  
   <div class="layui-form-item app2">
    
    
     <label class="layui-form-label addRedStar">单位行业</label>
    <div class="layui-input-inline">
      <select name="u_vocation" lay-filter="aihao" id="a4"></select>
    </div>
    
     <label class="layui-form-label addRedStar">工作职位类别</label>
    <div class="layui-input-inline">
      <select name="u_positiion" lay-filter="aihao" id="a5"></select>
    </div>
    
    <label class="layui-form-label addRedStar">组织机构代码</label>
    <div class="layui-input-inline">
      <input type="text" name="o_daima" lay-verify="title" placeholder="请输入组织机构代码" class="layui-input">
    </div>
      
    </div>

   <div class="layui-form-item app2">
    
    <div class="layui-form-item">
     <label class="layui-form-label addRedStar">单位所在地 </label>
        <div class="layui-inline" >
          <select name="u_location1" class="province"  lay-search lay-filter="province">
            <div class="name"></div>
            <option value="">省份</option>
          </select>
     
        </div>
        <div class="layui-inline">
          <select name="u_location2" class="city"  lay-search lay-filter="city">
            <option value="">地级市</option>
          </select>
        </div>
        <div class="layui-inline">
          <select name="u_location3" class="district"  lay-search>
            <option value="">县/区</option>
          </select>
        </div>
       <div class="layui-inline">
          <input type="text" name="u_address" lay-verify="title" placeholder="精确到门派号" class="layui-input">
        </div>
       
    </div>

 

    

  </div>

   <div class="layui-form-item app2">
    <label class="layui-form-label addRedStar">单位邮编</label>
    <div class="layui-input-inline">
      <input type="text" name="u_p_c" lay-verify="title" placeholder="请输入单位邮编" class="layui-input">
    </div>

     <label class="app2">单位是否接受档案</label>
    <div class="app2">
      <div style="float: left;" onclick="change(1)"><input type="radio" name="u_dangan" value="1" title="是" checked="" ></div>
      <div style="float: left;" onclick="change(0)"><input type="radio" name="u_dangan" value="0" title="否"  ></div>
    </div>

  </div>
<fieldset class="layui-elem-field layui-field-title app2" style="margin-top: 20px;">
   <legend>接收档案单位</legend>  
</fieldset>

  <div class="layui-form-item app app2"    >
    <label class="layui-form-label addRedStar">单位名称</label>
    <div class="layui-input-inline">
      <input type="text" name="rd_unitname" lay-verify="title" placeholder="请输入档案接收单位" class="layui-input">
    </div>

    <label class="layui-form-label addRedStar">单位邮编</label>
    <div class="layui-input-inline">
      <input type="text" name="d_unitp_c" lay-verify="title" placeholder="请输入转寄单位邮编" class="layui-input">
    </div>
  </div>

     <div class="layui-form-item app app2">
   

    

    <div class="layui-form-item">
     <label class="layui-form-label addRedStar">单位所在地 </label>
        <div class="layui-inline">
          <select name="d_unitaddr1" class="province1"  lay-search lay-filter="province1">
            <option value="">省份</option>
          </select>
        </div>
        <div class="layui-inline">
          <select name="d_unitaddr2" class="city1"  lay-search lay-filter="city1">
            <option value="">地级市</option>
          </select>
        </div>
        <div class="layui-inline">
          <select name="d_unitaddr3" class="district1"  lay-search>
            <option value="">县/区</option>
          </select>
        </div>
       <div class="layui-inline">
          <input type="text" name="d_unitaddr4" lay-verify="title" placeholder="精确到门派号" class="layui-input">
        </div>
       
    </div>



    </div>



 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
</fieldset>
  
 

  <div class="layui-form-item app2">
    <label class="layui-form-label addRedStar">单位联系人</label>
    <div class="layui-input-inline">
      <input type="text" name="u_lingkman" lay-verify="title" placeholder="请输入姓名" class="layui-input">
    </div>

    <label class="layui-form-label addRedStar">联系人电话</label>
      <div class="layui-input-inline">
        <input type="tel" name="linkman_tel"  autocomplete="off" class="layui-input" placeholder="请输入联系电话">
      </div>
  </div>


 <div class="layui-form-item app2">
    <label class="layui-form-label addRedStar">报到证单位名称</label>
    <div class="layui-input-inline">
      <input type="text" name="bq_unitname" lay-verify="title" placeholder="请输入报到证单位名称" class="layui-input">
    </div>
  </div>
 <div class="layui-form-item app2">
    
 

           <div class="layui-form-item">
     <label class="layui-form-label addRedStar">报到证单位所在地 </label>
        <div class="layui-inline">
          <select name="bq_unitaddr1" class="province2"  lay-search lay-filter="province2">
            <option value="">省份</option>
          </select>
        </div>
        <div class="layui-inline">
          <select name="bq_unitaddr2" class="city2"  lay-search lay-filter="city2">
            <option value="">地级市</option>
          </select>
        </div>
        <div class="layui-inline">
          <select name="bq_unitaddr3" class="district2"  lay-search>
            <option value="">县/区</option>
          </select>
        </div>

       
    </div>


         <div class="layui-upload" style="margin: 20px">
           <label class="layui-form-label addRedStar">三方协议或就业合同照片</label>
          <button type="button" class="layui-btn" id="test1">上传图片</button>
          <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo2">
            <p id="demoText"></p>
          </div>
        </div>

   

 
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button id="tijiao" type="submit" class="layui-btn" lay-submit="" lay-filter="demo1"  >立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
   


</div>

 
</form>



<script src="layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="js/cc.js"></script> 
<script src="js/area.js" type="text/javascript"></script>
<script src="js/select.js" type="text/javascript"></script>



  





<script type="text/javascript">

  function change(index){
    if(index){
     $('.app').css('display','block');
    }else{
       $('.app').css('display','none');
    }
  };
  function app2(index){
    if(index){
      $('.app2').css('display','none');
      $('.app3').css('display','block');
      
    }else{
        $('.app2').css('display','block');
        $('.app3').css('display','none');
    }
    
  }
  
 
</script>




 <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.10.3/dingtalk.open.js"></script>
 <script type="text/javascript">
      dd.ready(function() {
       async function promise(){
        
         let authcode = await dd.runtime.permission.requestAuthCode({
          corpId: "ding0896688e8dea267b35c2f4657eb6378f", // 企业id
            onSuccess: function (info) {
              return  info.code; // 通过该免登授权码可以获取用户身份
              }
        });

        authCode=JSON.parse(JSON.stringify(authcode)).code;
          let  acc = await $.ajax({
                   type: "GET",
                   url: "http://39.99.130.177:8005/api/Graduation/get_access_token",
                   data:{authCode:authCode},
                   dataType: "json",
                   success: function(data){
                      return data;
                   }
                 }); 
              let access_token = JSON.parse(JSON.stringify(acc)).data;
              
        
                 $(".img2 img").attr('src',access_token["head_img"]); 
                 $("#name").val(access_token["name"]);
                 $("#user_id").val(access_token["userid"]);
                   
                 
      }
      promise();
    });
    </script>





<script>

  var file;

  layui.use('upload', function(){
  var $ = layui.jquery,
  upload = layui.upload;
   

  //普通图片上传
  var uploadInst = upload.render({
    elem: '#test1',
    url: 'http://39.99.130.177:8005/api/Base/upload' ,//改成您自己的上传接口
    headers:{
      "Authorization":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjM2NzgsImF1ZGllbmNlIjoid2ViIiwib3BlbkFJZCI6MTM2NywiY3JlYXRlZCI6MTUzMzg3OTM2ODA0Nywicm9sZXMiOiJVU0VSIiwiZXhwIjoxNTM0NDg0MTY4fQ.Gl5L-NpuwhjuPXFuhPax8ak5c64skjDTCBC64N_QdKQ2VT-zZeceuzXB9TqaYJuhkwNYEhrV3pUx1zhMWG7Org",
    },
       

    before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo2').attr('src', result); //图片链接（base64）
      });
    },
    done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败'); //图片链接（base64）
      }
     file=res.data;
      
      //上传成功
    },
    error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  
 
  
});
  
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form,
  layer = layui.layer,
  layedit = layui.layedit,
  laydate = layui.laydate;
  
  //日期
  // laydate.render({
  //   elem: '#date'
  // });
  // laydate.render({
  //   elem: '#date1'
  // });
  
  //创建一个编辑器
  // var editIndex = layedit.build('LAY_demo_editor');
 

  
  //监听提交
  form.on('submit(demo1)', function(data){
    data.field.file=file;
    layer.alert(JSON.stringify(data.field), {
      title: '最终的提交信息'
    })
     
    $.ajax({
        url: 'http://39.99.130.177:8005/api/Test/tijiao',
        type:'post',
         data: data.field,
      
        dataType:"JSON",
            success: function (data1) {
                  layer.msg(data1.msg);    
                  
                    }
        });
      

    

   return false;
  });
 
  //表单赋值

  // //表单取值
  // layui.$('#LAY-component-form-getval').on('click', function(){
  //   var data = form.val('example');
  
  //    alert($("#a1").val());
   
  // });
  
});
</script>
 

</body>
</html>